Fix JSON generation bug with tab delimiters in MIME types parser#6
Merged
KSemenenko merged 3 commits intomainfrom Oct 12, 2025
Merged
Fix JSON generation bug with tab delimiters in MIME types parser#6KSemenenko merged 3 commits intomainfrom
KSemenenko merged 3 commits intomainfrom
Conversation
Co-authored-by: KSemenenko <4385716+KSemenenko@users.noreply.github.com>
Co-authored-by: KSemenenko <4385716+KSemenenko@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue with extra symbols in JSON generation
Fix JSON generation bug with tab delimiters in MIME types parser
Oct 12, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes a critical bug in the JSON generation process where MIME type files with tab delimiters were being incorrectly parsed, resulting in malformed JSON output containing tab characters and missing extension mappings.
- Fixed incorrect
Splitmethod usage that was treating the tab character as a count parameter instead of a delimiter - Changed to use proper character array syntax for splitting on both space and tab characters
- Added
*.trxto.gitignoreto exclude test result files
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Pull Request Test Coverage Report for Build 18441468452Details
💛 - Coveralls |
Pull Request Test Coverage Report for Build 18441468554Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The JSON generator was incorrectly parsing MIME type files that contain multiple tab delimiters between the MIME type and file extensions. This is a common format in Apache's
mime.typesfile.For example, the line:
Was incorrectly generating:
Instead of the correct output:
This resulted in MIME type values containing tab characters and partial extension names, and missing entries for extensions that should have been parsed.
Root Cause
The bug was in the
ParseMimeTypesListingmethod inManagedCode.MimeTypes.Sync/Program.csat line 148:This code appears to split on both space and tab characters, but actually uses an incorrect method signature. The
Split(char, char, StringSplitOptions)overload doesn't exist - instead, this resolves toSplit(char separator, int count, StringSplitOptions options)where the secondcharparameter is implicitly converted to anintcount/limit parameter.As a result, the split only used space as a delimiter, leaving all tab characters in the first part of the split result.
Solution
Changed to use the correct
Splitsignature with a character array:This ensures both space and tab characters are properly recognized as delimiters when parsing MIME type files.
Testing
atcandacutc) are now correctly mapped to the same MIME typeAdditional Changes
*.trxto.gitignoreto exclude test result files from version controlFixes the issue reported in the original bug report referencing PR #4.
Original prompt
Fixes #5
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.